import telnetlib
import pygame
import time

#host = "192.168.4.1"
#port = 100
#timeout = 100
#tn = telnetlib.Telnet(host,port,timeout=10)

pygame.init()
size=[640,480]
screen=pygame.display.set_mode(size)
clock=pygame.time.Clock()
done=False
while not done:
    bg = pygame.image.load('1.jpg')
    screen.blit(bg, (0, 0))
    pygame.display.update()
    keys=pygame.key.get_pressed()
    #if keys[pygame.K_w]:
        #tn.write(b"W\n")
    #if keys[pygame.K_s]:
        #tn.write(b"B\n")
    #if keys[pygame.K_a]:
        #tn.write(b"L\n")
    #if keys[pygame.K_d]:
        #tn.write(b"R\n")
    if keys[pygame.K_q]:
        #tn.close()
        time.sleep(1)
        done=True

    for event in pygame.event.get():
        if event.type==pygame.QUIT:
            done=True
    clock.tick(32)

pygame.quit()

#while True:
    #if keyboard.is_pressed('w'):
    #elif keyboard.is_pressed('s'):
    #elif keyboard.is_pressed('a'):
    #elif keyboard.is_pressed('d'):
    #elif keyboard.is_pressed('q'):
